package Huihu.src.Duoxiancheng;
//抢票
public class Runnablees implements  Runnable{
    private int tictkets=10;
    @Override
    public void run() {
        while (true) {
            if (tictkets<=0) {
                break;
            }
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"抢到了第"+tictkets--+"张票");
        }
    }

    public static void main(String[] args) {
        Runnablees runnablees=new Runnablees();
        new Thread(runnablees,"小明").start();
        new Thread(runnablees,"老师").start();
        new Thread(runnablees,"黄牛党").start();
    }
}
